<template>
  <div class='search'>
    <f-form ref='saleManform' :action='api.saleMan' :form-key='this.formItem.saleManId'>
      <f-form-item label='姓名' name='saleManName' :value='formItem.saleManName' :required='true' />
      <f-form-item label='联系电话' name='linkTel' :value='formItem.linkTel' />
      <f-form-item label='银行名称' name='bankName' :required='true' :value='formItem.bankName' />
      <f-form-item label='银行卡号' name='bankNo' :required='true' :value='formItem.bankNo' />
      <f-form-item label='备注' name='remark' :value='formItem.remark' />
    </f-form>
  </div>
</template>
<script>
import api from "../js/api"

export default {
  name: "salemanAdd",
  props: {},
  data() {
    return {
      refs: this.$refs,
      api: Object.assign(api, this.api),
      isAdd: true,//是否是添加模式
      loaded: false,//是否加载完成
      formItem: this.getFormItem()
    }
  },
  methods: {
    getFormItem() {
      return {
        saleManId: "",
        saleManName: "",
        deptManager: "",
        deptId: null,
        linkTel: "",
        bankNo: "",
        bankName: ""
      }
    },
    //表单赋值
    setData(data) {
      this.$refs.saleManform.resetFields()
      this.formItem = this.getFormItem()
      this.formItem.deptId = data.deptId
      if (data && data.saleManId) {
        let params = {
          saleManId: data.saleManId
        }
        this.refs["saleManform"].getDetails(params, (data) => {
          this.formItem = data
          this.loaded = true
        })
        this.isAdd = false
      } else {
        this.loaded = true
      }
    },
    //提交表单
    handleSubmit(callback) {
      this.$refs.saleManform.submit({}, callback)
    }
  },
  created() {
  },
  components: {}
}
</script>

<style scoped lang='less' rel='stylesheet/less'>

</style>
